<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>修改密码</title>
    <link href="/myhouse/static/web/css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="/myhouse/static/web/js/jquery.min.js"></script>
    <!-- Custom Theme files -->
    <!--menu-->
    <script src="/myhouse/static/web/js/scripts.js"></script>
    <link href="/myhouse/static/web/css/styles.css" rel="stylesheet">
    <!--//menu-->
    <!--theme-style-->
    <link href="/myhouse/static/web/css/style.css" rel="stylesheet" type="text/css" media="all" />
    <!--//theme-style-->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="Real Home Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
    <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
</head>
<body>
<script src="/myhouse/static/web/js/easyResponsiveTabs.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#horizontalTab').easyResponsiveTabs({
            type: 'default', //Types: default, vertical, accordion
            width: 'auto', //auto or any width like 600px
            fit: true   // 100% fit in a container
        });
    });
</script>
<!--header-->
<jsp:include page="/inc/head.jsp"></jsp:include>
<!--//-->
<div class=" banner-buying">
    <div class=" container">
        <h3><span>MY</span>house</h3>
        <!---->
        <jsp:include page="/inc/menu.jsp"></jsp:include>
        <div class="clearfix"> </div>
        <script type="text/javascript">
            $(function() {
                var menu_ul = $('.menu > li > ul'),
                    menu_a  = $('.menu > li > a');
                menu_ul.hide();
                menu_a.click(function(e) {
                    e.preventDefault();
                    if(!$(this).hasClass('active')) {
                        menu_a.removeClass('active');
                        menu_ul.filter(':visible').slideUp('normal');
                        $(this).addClass('active').next().stop(true,true).slideDown('normal');
                    } else {
                        $(this).removeClass('active');
                        $(this).next().stop(true,true).slideUp('normal');
                    }
                });

            });
        </script>
        <script src="myhouse/webapp/static/js/jquery.min.js"></script>


    </div>
</div>
<script type="text/javascript">
    function userpassv(){
        var reg = /^\w{6,8}$/;
        var pass = $("#userpass").val()
        if (reg.test(pass) && pass != ""){
            $("#pass").text("√");
            $("#pass").css("color","green");
        }else {
            $("#pass").text("×");
            $("#pass").css("color","red");
        }
    }
</script>
<script >
    $(function (){
        $("#myhouse").submit(sss)
    })
</script>
<script>
    function sss(){
        var mima = $("#aaa").val()

        var xinmima = $("#userpass").val()
        var jiu = $("#old").val()

        var zen =/^.{6,8}$/

        if (jiu == xinmima){
            var news = $("#news").html("旧密码与新密码不能一致")
            var news = $("#news").css("color","red")
            return false;
            alert("aaaa")
        }else if (jiu!=mima){
            var newss = $("#news").html("旧密码错误")
            var newss = $("#news").css("color","red")
            return false;
            alert("bbb")
        }else if (jiu==""&&xinmima==""){
            var news = $("#news").html("不能为空")
            var newss = $("#news").css("color","red")
            return false;
            alert("ccc")
        }else {
            return true
        }
    }
</script>
<div class="login-right">
    <div class="container">
        <h3>密码</h3>
        <div class="login-top">
            <div class="form-info">
                <form  method="post"  action="/myhouse/web/update" id="myhouse">
                    <input type="hidden" value="${requestScope.ser.userName}" name="userName">
                    <input type="hidden" value="${requestScope.ser.userPass}" id="aaa">
                    旧密码：<input type="password"  placeholder="请输入旧密码"  id="old" >
                    <span id="pass"></span>
                    新密码：<input type="password" placeholder="请输入新密码" id="userpass" name="userPass">
                    <span id="news"></span>
                    <br><br><br>
                    <input type="submit"   value="修改">
                    <br>
                    <a href="/myhouse/web/info" style="width: 50px;margin-left: 200px ;position: relative;top: -20px">返回</a>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    $(function (){
        $("#dl").click(yanzheng);
    });
    //用ajax验证用户名和密码是否正确
    var flag;
    function yanzheng(){

        var userName = $("#username").val();
        var userPass = $("#userpass").val();
        $.ajax({
            url:"/myhouse/web/userLogin",
            type:"post",
            async:false,
            data:{userName:userName,userPass:userPass},
            success:function (mes){
                if (mes == "1"){
                    if (flag){
                        location.href = "/myhouse/web/index";
                    }
                }else if(mes == "0"){
                    $("#myspan").html("用户名或密码错误")
                    $("#myspan").css("color","red")
                }
            }
        });
    }
</script>
<!--//contact-->
<!--footer-->
<jsp:include page="/inc/footer.jsp"></jsp:include>
<!--//footer-->
</body>
</html>